<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateUserQuestionRecordsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_question_records', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('exam_paper_id')->comment("试卷id");
            $table->unsignedInteger('users_id')->comment("用户id");
            $table->string('username')->comment("用户名");
            $table->unsignedInteger('exam_paper_question_id')->comment("试卷试题id");
            $table->string('user_answer')->comment("用户答案");
            $table->tinyInteger("is_correct")->default(0)->comment("是否正确[否|是]");
            $table->unsignedInteger('score')->comment("分数");

            $table->timestamps();
            $table->softDeletes();

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_question_records');
    }
}
